package day03.gc;

import java.util.ArrayList;

/**
 * @Auther: Min.Liu
 * @Description:
 * 堆初始大小 -Xms
 * 堆最大大小 -Xmx 或 -XX:MaxHeapSize=size
 * 新生代大小 -Xmn 或 (-XX:NewSize=size + -XX:MaxNewSize=size )
 * 幸存区比例（动态） -XX:InitialSurvivorRatio=ratio 和 -XX:+UseAdaptiveSizePolicy
 * 幸存区比例 -XX:SurvivorRatio=ratio
 * 晋升阈值 -XX:MaxTenuringThreshold=threshold
 * 晋升详情 -XX:+PrintTenuringDistribution
 * GC详情 -XX:+PrintGCDetails -verbose:gc
 * FullGC 前 MinorGC -XX:+ScavengeBeforeFullGC
 *
 * 查看虚拟机运行参数
 * "C:\Program Files\Java\jdk1.8.0_91\bin\java" -XX:+PrintFlagsFinal -version | findstr "GC"
 * @Date: Created in 15:04 2025/4/16
 */
public class demo1 {
    private static final int _512KB = 512 * 1024;
    private static final int _1MB = 1024 * 1024;
    private static final int _6MB = 6 * 1024 * 1024;
    private static final int _7MB = 7 * 1024 * 1024;
    private static final int _8MB = 8 * 1024 * 1024;

    // -Xms20M -Xmx20M -Xmn10M -XX:+UseSerialGC -XX:+PrintGCDetails -verbose:gc -XX:-ScavengeBeforeFullGC
    public static void main(String[] args) throws InterruptedException {
//        new Thread(() -> {
//            ArrayList<byte[]> list = new ArrayList<>();
//            list.add(new byte[_8MB]);
//            list.add(new byte[_8MB]);
//        }).start();

//        System.out.println("sleep....");
        //Thread.sleep(1000L);
    }
}
